package ipaintplugin.objects;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Display;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public abstract class Polygon extends Figure {

	protected Color fillColor = getColor(SWT.COLOR_WHITE);
	protected String fillColorString = "#ffffff";

	protected Polygon() {
		super();
	}

	@Override
	public void draw(GC canvas) {
		// TODO Auto-generated method stub
		super.draw(canvas);
		canvas.setBackground(fillColor);
	}

	@Override
	public void toXML(Document doc, Element el) {
		el.setAttribute("fillColor", fillColorString);
		super.toXML(doc, el);
	}

	@Override
	public void fromXML(Node el) {
		fillColorString = el.getAttributes().getNamedItem("fillColor")
				.getNodeValue();

		fillColor = getRGBColor(fillColorString);
		// TODO get fillColor
		super.fromXML(el);
	}

}
